/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package bo;
import dto.ProductDTO;
import java.sql.SQLException;
import java.util.ArrayList;
import mapper.ProductMapper;
/**
 *
 * @author Tam Nguyen
 */
public class Product_BUS {
    public ArrayList<dto.ProductDTO> LoadProduct( int category_id ) throws SQLException
    {
        mapper.ProductMapper mapper = new ProductMapper();
        return (mapper.LoadProduct(category_id));
    }

    public ProductDTO LoadDetailsProduct( String product_id ) throws SQLException
    {
        mapper.ProductMapper mapper = new ProductMapper();
        return (mapper.LoadDetailsProduct(product_id));
    }

    public ProductDTO GetOneProduct(String ID) throws SQLException       
    {
        mapper.ProductMapper mapper = new ProductMapper();
        return (mapper.GetOneProduct(ID));
    }
    public ArrayList<dto.ProductDTO> LoadAllProduct() throws SQLException
    {
        mapper.ProductMapper mapper = new ProductMapper();
        return (mapper.LoadAllProduct());
    }
    
    public boolean AddProduct(ProductDTO pr) throws SQLException
    {
        mapper.ProductMapper mapper = new ProductMapper();
        return (mapper.AddProduct(pr));
    }
    
    public boolean DeleteProduct(String prid) throws SQLException
    {
        mapper.ProductMapper mapper = new ProductMapper();
        return (mapper.DeleteProduct(prid));
    }
    public boolean UpdateProduct(ProductDTO pr) throws SQLException
    {
        mapper.ProductMapper mapper = new ProductMapper();
        return (mapper.UpdateProduct(pr));
    }
}
